package com.mxx.common.netty.config;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.util.ClassUtils;

/**
 * @author: mxx
 * @date: 2021/9/26
 * @time: 14:10
 * @Description: 描述信息
 */
public class LoadNettySelector implements ImportSelector {

    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {
        ClassLoader classLoader = this.getClass().getClassLoader();
        if (ClassUtils.isPresent("javax.validation.ValidatorFactory", classLoader)) {
            return new String[]{"com.mxx.common.netty.http.validate.ValidatorConfig"};
        }

        return new String[0];
    }
}
